home *** CD-ROM | disk | FTP | other *** search
/ Macintosh Technology Seed 1996 September / Macintosh Technology Seed (September 1996) (CDRM1437020).ISO / pc / qd3d15d6 / 15d6_sdk.exe / QD3D Win32 1.5d6 / Interfaces / QD3DErrors.h < prev    next >
C/C++ Source or Header  |  1996-08-21  |  10KB  |  337 lines

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DErrors.h                                             **
  4.  **                                                                             **
  5.  **                                                                             **
  6.  **     Purpose:    Error API and error codes                                 **
  7.  **                                                                             **
  8.  **                                                                             **
  9.  **                                                                             **
  10.  **     Copyright (C) 1992-1995 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                             **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DError_h
  15. #define QD3DError_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  22. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  23.     #pragma options enum=small
  24. #endif
  25. #include <Types.h>
  26. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  27.     #pragma options enum=reset
  28. #endif
  29. #endif  /*  OS_MACINTOSH  */
  30.  
  31. #if defined(THINK_C) || defined(__SC__)
  32.     #pragma options(!pack_enums, !align_arrays)
  33.     #pragma SC options align=power
  34. #elif defined(__MWERKS__)
  35.     #pragma enumsalwaysint on
  36.     #pragma align_array_members off
  37.     #pragma options align=native
  38. #elif defined(__PPCC__)
  39.     #pragma options align=power
  40. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  41.     #pragma options enum=int
  42. #endif
  43.  
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif  /*  __cplusplus  */
  47.  
  48.  
  49. /******************************************************************************
  50.  **                                                                             **
  51.  **                            Error Types and Codes                             **
  52.  **                                                                             **
  53.  *****************************************************************************/
  54.  
  55. typedef enum TQ3Error {
  56.     kQ3ErrorNone = 0,        
  57.     /* Fatal Errors */
  58.     kQ3ErrorInternalError            = -28500,
  59.     kQ3ErrorNoRecovery,
  60.     kQ3ErrorLastFatalError,
  61.     /* System Errors */
  62.     kQ3ErrorNotInitialized            = -28490,
  63.     kQ3ErrorAlreadyInitialized,
  64.     kQ3ErrorUnimplemented,
  65.     kQ3ErrorRegistrationFailed,
  66.     /* OS Errors */
  67.     kQ3ErrorUnixError,
  68.     kQ3ErrorMacintoshError,
  69.     kQ3ErrorX11Error,
  70.     /* Memory Errors */
  71.     kQ3ErrorMemoryLeak,
  72.     kQ3ErrorOutOfMemory,
  73.     /* Parameter errors */
  74.     kQ3ErrorNULLParameter,
  75.     kQ3ErrorParameterOutOfRange,
  76.     kQ3ErrorInvalidParameter,            
  77.     kQ3ErrorInvalidData,                
  78.     kQ3ErrorAcceleratorAlreadySet,        
  79.     kQ3ErrorVector3DNotUnitLength,
  80.     kQ3ErrorVector3DZeroLength,
  81.     /* Object Errors */
  82.     kQ3ErrorInvalidObject,
  83.     kQ3ErrorInvalidObjectClass,
  84.     kQ3ErrorInvalidObjectType,
  85.     kQ3ErrorInvalidObjectName,
  86.     kQ3ErrorObjectClassInUse,            
  87.     kQ3ErrorAccessRestricted,
  88.     kQ3ErrorMetaHandlerRequired,
  89.     kQ3ErrorNeedRequiredMethods,
  90.     kQ3ErrorNoSubClassType,
  91.     kQ3ErrorUnknownElementType,
  92.     kQ3ErrorNotSupported,
  93.     /* Extension Errors */
  94.     kQ3ErrorNoExtensionsFolder,
  95.     kQ3ErrorExtensionError,
  96.     kQ3ErrorPrivateExtensionError,
  97.     /* Geometry Errors */
  98.     kQ3ErrorDegenerateGeometry,
  99.     kQ3ErrorGeometryInsufficientNumberOfPoints,
  100.     /* IO Errors */
  101.     kQ3ErrorNoStorageSetForFile,
  102.     kQ3ErrorEndOfFile,
  103.     kQ3ErrorFileCancelled,
  104.     kQ3ErrorInvalidMetafile,
  105.      kQ3ErrorInvalidMetafilePrimitive,
  106.      kQ3ErrorInvalidMetafileLabel,
  107.      kQ3ErrorInvalidMetafileObject,
  108.      kQ3ErrorInvalidMetafileSubObject,
  109.     kQ3ErrorInvalidSubObjectForObject,
  110.     kQ3ErrorUnresolvableReference,
  111.     kQ3ErrorUnknownObject,
  112.     kQ3ErrorStorageInUse,
  113.     kQ3ErrorStorageAlreadyOpen,
  114.     kQ3ErrorStorageNotOpen,
  115.     kQ3ErrorStorageIsOpen,
  116.     kQ3ErrorFileAlreadyOpen,
  117.     kQ3ErrorFileNotOpen,
  118.     kQ3ErrorFileIsOpen,
  119.     kQ3ErrorBeginWriteAlreadyCalled,
  120.     kQ3ErrorBeginWriteNotCalled,
  121.     kQ3ErrorEndWriteNotCalled,
  122.     kQ3ErrorReadStateInactive,
  123.     kQ3ErrorStateUnavailable,
  124.     kQ3ErrorWriteStateInactive,
  125.     kQ3ErrorSizeNotLongAligned,
  126.     kQ3ErrorFileModeRestriction,
  127.     kQ3ErrorInvalidHexString,
  128.     kQ3ErrorWroteMoreThanSize,
  129.     kQ3ErrorWroteLessThanSize,
  130.     kQ3ErrorReadLessThanSize,
  131.     kQ3ErrorReadMoreThanSize,
  132.     kQ3ErrorNoBeginGroup,
  133.     kQ3ErrorSizeMismatch,
  134.     kQ3ErrorStringExceedsMaximumLength,
  135.     kQ3ErrorValueExceedsMaximumSize,
  136.     kQ3ErrorNonUniqueLabel,
  137.     kQ3ErrorEndOfContainer,
  138.     kQ3ErrorUnmatchedEndGroup,
  139.     kQ3ErrorFileVersionExists,
  140.     /* View errors */
  141.     kQ3ErrorViewNotStarted,
  142.     kQ3ErrorViewIsStarted,
  143.     kQ3ErrorRendererNotSet,
  144.     kQ3ErrorRenderingIsActive,
  145.     kQ3ErrorImmediateModeUnderflow,
  146.     kQ3ErrorDisplayNotSet,
  147.     kQ3ErrorCameraNotSet,
  148.     kQ3ErrorDrawContextNotSet,
  149.     kQ3ErrorNonInvertibleMatrix,
  150.     kQ3ErrorRenderingNotStarted,
  151.     kQ3ErrorPickingNotStarted,
  152.     kQ3ErrorBoundsNotStarted,
  153.     kQ3ErrorDataNotAvailable,
  154.     kQ3ErrorNothingToPop,
  155.     /* Renderer Errors */
  156.     kQ3ErrorUnknownStudioType,            
  157.     kQ3ErrorAlreadyRendering,
  158.     kQ3ErrorStartGroupRange,
  159.     kQ3ErrorUnsupportedGeometryType,
  160.     kQ3ErrorInvalidGeometryType,
  161.     kQ3ErrorUnsupportedFunctionality,
  162.     /* Group Errors */
  163.     kQ3ErrorInvalidPositionForGroup,
  164.     kQ3ErrorInvalidObjectForGroup,
  165.     kQ3ErrorInvalidObjectForPosition,
  166.     /* Transform Errors */
  167.     kQ3ErrorScaleOfZero,                
  168.     /* String Errors */
  169.     kQ3ErrorBadStringType,                
  170.     /* Attribute Errors */
  171.     kQ3ErrorAttributeNotContained,        
  172.     kQ3ErrorAttributeInvalidType,        
  173.     /* Camera Errors */
  174.     kQ3ErrorInvalidCameraValues,        
  175.     /* DrawContext Errors */
  176.     kQ3ErrorBadDrawContextType,
  177.     kQ3ErrorBadDrawContextFlag,
  178.     kQ3ErrorBadDrawContext,
  179.     kQ3ErrorUnsupportedPixelDepth,
  180.     /* Controller Errors */
  181.     kQ3ErrorController,
  182.     /* Tracker Errors */
  183.     kQ3ErrorTracker,
  184.     /* Another OS Error */
  185.     kQ3ErrorWin32Error,
  186.     /* Object Errors */
  187.     kQ3ErrorTypeAlreadyExistsAndHasSubclasses,
  188.     kQ3ErrorTypeAlreadyExistsAndOtherClassesDependOnIt,
  189.     kQ3ErrorTypeAlreadyExistsAndHasObjectInstances
  190. } TQ3Error;
  191.  
  192. typedef enum TQ3Warning {
  193.     kQ3WarningNone = 0,
  194.     /* General System */
  195.     kQ3WarningInternalException = -28300,    
  196.     /* Object Warnings */
  197.     kQ3WarningNoObjectSupportForDuplicateMethod,
  198.     kQ3WarningNoObjectSupportForDrawMethod,
  199.     kQ3WarningNoObjectSupportForWriteMethod,
  200.     kQ3WarningNoObjectSupportForReadMethod,
  201.     kQ3WarningUnknownElementType,
  202.     kQ3WarningTypeAndMethodAlreadyDefined,
  203.     kQ3WarningTypeIsOutOfRange,
  204.     kQ3WarningTypeHasNotBeenRegistered,
  205.     /* Parameter Warnings */
  206.     kQ3WarningVector3DNotUnitLength,
  207.     /* IO Warnings */
  208.     kQ3WarningInvalidSubObjectForObject,
  209.     kQ3WarningInvalidHexString,
  210.     kQ3WarningUnknownObject,
  211.     kQ3WarningInvalidMetafileObject,
  212.     kQ3WarningUnmatchedBeginGroup,
  213.     kQ3WarningUnmatchedEndGroup,
  214.     kQ3WarningInvalidTableOfContents,
  215.     kQ3WarningUnresolvableReference,
  216.     kQ3WarningNoAttachMethod,
  217.     kQ3WarningInconsistentData,
  218.     kQ3WarningReadLessThanSize,
  219.     kQ3WarningFilePointerResolutionFailed,
  220.     kQ3WarningFilePointerRedefined,
  221.     kQ3WarningStringExceedsMaximumLength,
  222.     /* Memory Warnings */
  223.     kQ3WarningLowMemory,
  224.     kQ3WarningPossibleMemoryLeak,
  225.     /* View Warnings */
  226.     kQ3WarningViewTraversalInProgress,
  227.     kQ3WarningNonInvertibleMatrix,
  228.     /* Quaternion Warning */
  229.     kQ3WarningQuaternionEntriesAreZero,
  230.     /* Renderer Warning */
  231.     kQ3WarningFunctionalityNotSupported,
  232.     /* DrawContext Warning */
  233.     kQ3WarningInvalidPaneDimensions,
  234.     /* Pick Warning */
  235.     kQ3WarningPickParamOutside,
  236.     /* Scale Warnings */
  237.     kQ3WarningScaleEntriesAllZero,
  238.     kQ3WarningScaleContainsNegativeEntries,
  239.     /* Generic Warnings */
  240.     kQ3WarningParameterOutOfRange,
  241.     /* Extension Warnings */
  242.     kQ3WarningExtensionNotLoading,
  243.     /* Object Warnings */
  244.     kQ3WarningTypeSameVersionAlreadyRegistered,
  245.     kQ3WarningTypeNewerVersionAlreadyRegistered
  246. } TQ3Warning;
  247.  
  248.  
  249. typedef enum TQ3Notice {
  250.     kQ3NoticeNone = 0,
  251.     kQ3NoticeDataAlreadyEmpty = -28100,
  252.     kQ3NoticeMethodNotSupported,
  253.     kQ3NoticeObjectAlreadySet,
  254.     kQ3NoticeParameterOutOfRange,
  255.     kQ3NoticeFileAliasWasChanged,
  256.     kQ3NoticeMeshVertexHasNoComponent,
  257.     kQ3NoticeMeshInvalidVertexFacePair,
  258.     kQ3NoticeMeshEdgeVertexDoNotCorrespond,
  259.     kQ3NoticeMeshEdgeIsNotBoundary,
  260.     kQ3NoticeDrawContextNotSetUsingInternalDefaults,
  261.     kQ3NoticeInvalidAttenuationTypeUsingInternalDefaults,
  262.     kQ3NoticeBrightnessGreaterThanOne,
  263.     kQ3NoticeScaleContainsZeroEntries,
  264.     kQ3NoticeSystemAlreadyInitialized,
  265.     kQ3NoticeViewSyncCalledAgain
  266. } TQ3Notice;
  267.  
  268. typedef void (*TQ3ErrorMethod)(
  269.     TQ3Error    firstError,
  270.     TQ3Error    lastError,
  271.     long        reference);
  272.     
  273. typedef void (*TQ3WarningMethod)(
  274.     TQ3Warning    firstWarning,
  275.     TQ3Warning    lastWarning,
  276.     long        reference);
  277.  
  278. typedef void (*TQ3NoticeMethod)(
  279.     TQ3Notice    firstNotice,
  280.     TQ3Notice    lastNotice,
  281.     long        reference);
  282.  
  283.  
  284. /******************************************************************************
  285.  **                                                                             **
  286.  **                                Error Routines                                 **
  287.  **                                                                             **
  288.  *****************************************************************************/
  289.  
  290. QD3D_EXPORT TQ3Status Q3Error_Register(
  291.     TQ3ErrorMethod        errorPost,
  292.     long                reference);
  293.  
  294. QD3D_EXPORT TQ3Status Q3Warning_Register(
  295.     TQ3WarningMethod    warningPost,
  296.     long                reference);
  297.  
  298. QD3D_EXPORT TQ3Status Q3Notice_Register(
  299.     TQ3NoticeMethod        noticePost,
  300.     long                reference);
  301.  
  302. /*
  303.  *  Getting error codes -
  304.  *    Clears error type on next entry into system (except all of these 
  305.  *  error calls), and returns the last error, and optionally the 
  306.  *    first error. The parameter to these "_Get" calls may be NULL.
  307.  */
  308. QD3D_EXPORT TQ3Error Q3Error_Get(
  309.     TQ3Error            *firstError);
  310.  
  311. QD3D_EXPORT TQ3Boolean Q3Error_IsFatalError(
  312.     TQ3Error            error);
  313.  
  314. QD3D_EXPORT TQ3Warning Q3Warning_Get(
  315.     TQ3Warning            *firstWarning);
  316.  
  317. QD3D_EXPORT TQ3Notice Q3Notice_Get(
  318.     TQ3Notice            *firstNotice);
  319.  
  320. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  321.  
  322. QD3D_EXPORT OSErr Q3MacintoshError_Get(
  323.     OSErr                *firstMacErr);
  324.  
  325. #endif  /*  OS_MACINTOSH  */
  326. #ifdef __cplusplus
  327. }
  328. #endif  /*  __cplusplus  */
  329.  
  330. #if defined(__MWERKS__)
  331.     #pragma enumsalwaysint reset
  332. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  333.     #pragma options enum=reset
  334. #endif
  335.  
  336. #endif    /*  QD3DError_h  */
  337.